package com.eastmoney.emis.edda.config;

import com.eastmoney.emis.logger.LoggerFactory;
import org.slf4j.Logger;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @description: Description
 * @projectName: EDDA-HSBC
 * @package: com.eastmoney.emis.edda.config
 * @author: 汪程程
 * @date: 2022/9/26 2:06 PM
 * @version: 1.0
 */
@Configuration
@ConfigurationProperties(prefix = "edda.hsbc")
public class HsbcEddaConfig {
    private static final Logger log = LoggerFactory.getLogger(HsbcEddaConfig.class);
    private String profileId;
    private String clientId;
    private String clientSecret;
    private String countryCode;

    private String baseUrl;

    private String hsbcBankCode = "004";

    private CreditorAccount creditorAccount;

    private String depositBankAccount;

    private String depositBankId;

    @PostConstruct
    public void afterPropertiesSet() {
        log.info("init HsbcEddaConfig succeed: {}", this);
    }

    public String getProfileId() {
        return profileId;
    }

    public void setProfileId(String profileId) {
        this.profileId = profileId;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getClientSecret() {
        return clientSecret;
    }

    public void setClientSecret(String clientSecret) {
        this.clientSecret = clientSecret;
    }

    public String getCountryCode() {
        return countryCode;
    }

    public void setCountryCode(String countryCode) {
        this.countryCode = countryCode;
    }

    public String getBaseUrl() {
        return baseUrl;
    }

    public void setBaseUrl(String baseUrl) {
        this.baseUrl = baseUrl;
    }


    public String getHsbcBankCode() {
        return hsbcBankCode;
    }

    public void setHsbcBankCode(String hsbcBankCode) {
        this.hsbcBankCode = hsbcBankCode;
    }

    public CreditorAccount getCreditorAccount() {
        return creditorAccount;
    }

    public void setCreditorAccount(CreditorAccount creditorAccount) {
        this.creditorAccount = creditorAccount;
    }

    public String getDepositBankAccount() {
        return depositBankAccount;
    }

    public void setDepositBankAccount(String depositBankAccount) {
        this.depositBankAccount = depositBankAccount;
    }

    public String getDepositBankId() {
        return depositBankId;
    }

    public void setDepositBankId(String depositBankId) {
        this.depositBankId = depositBankId;
    }

    @Override
    public String toString() {
        return "HsbcEddaConfig{" +
                "profileId='" + profileId + '\'' +
                ", clientId='" + clientId.substring(0,8) + '\'' +
                ", clientSecret='" + clientSecret.substring(0,8) + '\'' +
                ", countryCode='" + countryCode + '\'' +
                ", baseUrl='" + baseUrl + '\'' +
                ", hsbcBankCode='" + hsbcBankCode + '\'' +
                '}';
    }
}
